package com.lonely.order.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lonely.goods.domain.dto.goods.GoodsQuotationSheetPartSecondProcessDTO;
import com.lonely.order.domain.dto.secondprocess.*;
import com.lonely.order.domain.entity.SysOrder;
import com.lonely.order.domain.entity.SysOrderPart;
import com.lonely.order.domain.entity.SysOrderSecondProcess;
import com.lonely.order.domain.vo.secondprocess.QueryOrderSecondProcessPageQueryVO;

import java.util.List;
import java.util.Map;

/**
 * @author : 黄志标
 * @date: 2025/7/2 10:45
 * @description: 订单二次工艺接口
 */
public interface IOrderSecondProcessService extends IService<SysOrderSecondProcess> {

    /**
     * 创建订单二次工艺
     *
     * @param sysOrderPart
     * @param goodsPartId
     */
    void createOrderSecondProcess(SysOrderPart sysOrderPart, Long goodsPartId, SysOrder sysOrder);

    /**
     * 查询商品报价单部件二次工艺信息
     *
     * @param orderPartId
     * @return
     */
    List<GoodsQuotationSheetPartSecondProcessDTO> queryQuotationSheetPartSecondProcesses(Long orderPartId);

    /**
     * 查询商品报价单部件成衣二次工艺信息
     *
     * @param orderPartId
     * @return
     */
    List<GoodsQuotationSheetPartSecondProcessDTO> queryQuotationSheetPartReadyToWearSecondProcesses(Long orderPartId);


    /**
     * 分页查询
     *
     * @param queryDto
     * @return
     */
    Page<QueryOrderSecondProcessPageQueryVO> page(QueryOrderSecondProcessPageQueryDTO queryDto);

    /**
     * 二次工艺确认
     *
     * @param requestDto
     */
    void confirmSecondProcess(ConfirmSecondProcessDTO requestDto);

    /**
     * 修改裁片二次工艺
     *
     * @param requestDto
     */
    void updateCuttingSecondProcess(UpdateCuttingSecondProcessDTO requestDto);

    /**
     * 工艺发起
     *
     * @param requestDto
     */
    void processInitiation(ProcessInitiationDTO requestDto);

    /**
     * 工艺回料
     *
     * @param requestDto
     */
    void processRecycledMaterial(ProcessRecycledMaterialDTO requestDto);

    /**
     * 获取默认的发料数量
     *
     * @param produceOrderId
     * @return
     */
    Integer getDefaultRecycledMaterialsQuantity(Long produceOrderId);

    /**
     * 统计指定查询条件下的各个状态的数量
     *
     * @param queryDto
     * @return
     */
    Map<Integer, Integer> getStatusTotals(QueryOrderSecondProcessPageQueryDTO queryDto);

    /**
     * 判断指定订单是否存在二次工艺
     *
     * @param produceOrderId
     * @return
     */
    boolean isExistOrderSecondProcess(Long produceOrderId);

    /**
     * 判断指定订单是否存在裁片二次工艺是否需要确认
     *
     * @param produceOrderId
     * @return
     */
    boolean isExistCuttingSecondProcessNeedConfirm(Long produceOrderId);

    /**
     * 判断二次工艺中裁片二次工艺为是的是否都已回料了
     *
     * @param produceOrderId
     * @return
     */
    boolean isAllCuttingSecondProcessReturned(Long produceOrderId);
}
